import {appInjector} from '../../utils/app-injector';
import {MessageService} from '../../../services/system/message.service';
import {WindowService} from '../../../services/system/window.service';
import {RequestService} from '../../../services/system/request.service';
import {ActivatedRoute, Router} from '@angular/router';
import { ApplicationRef, ComponentFactoryResolver, Injector, Input, Directive } from '@angular/core';
import {PermissionService} from '../../../services/system/permission.service';
import {CommonService} from '../../../services/system/common.service';
import {CacheDataService} from '../../../services/system/cache.data.service';

@Directive()
export class DhlCommonComponent {

  messageService = appInjector().get(MessageService);
  windowService = appInjector().get(WindowService);
  requestService = appInjector().get(RequestService);
  activeRouter = appInjector().get(ActivatedRoute);
  router = appInjector().get(Router);
  cacheService = appInjector().get(CacheDataService);
  componentFactory = appInjector().get(ComponentFactoryResolver);
  permissionService = appInjector().get(PermissionService);
  commonService = appInjector().get(CommonService);
  injector = appInjector().get(Injector);
  applicationRef = appInjector().get(ApplicationRef);

  @Input() show = true;

  @Input() set checkPermission(value) {
    this.show = this.permissionService.checkPermission(value);
  };
}
